/**
 * Copyright (c) 2007,中企动力华南研发中心<br>
 * All rights reserved.
 */
package com.ce.pms.renovation.dao.impl;

import java.util.List;

import org.hibernate.Query;

import com.ce.pms.base.dao.impl.PmsBaseDaoImpl;
import com.ce.pms.renovation.dao.IRenovateApprovalDao;
import com.ce.pms.renovation.model.RenovateApprovalDO;

/**
 * 功能描述：<br>
 * @author 罗军林 创建日期：2008-12-31
 */
public class RenovateApprovalDaoImpl extends PmsBaseDaoImpl<RenovateApprovalDO> implements IRenovateApprovalDao {

	/**
	 * 功能描述:查询所有已经审核过的装修申请审批结果<br>
	 * @param requisitionId
	 * @return<br>
	 * Create author:罗军林<br>
	 * Create on:2008-12-31<br>
	 * Edit author:<br>
	 * Edit on:<br>
	 * Why:<br>
	 */
	public List<RenovateApprovalDO> getAllIsHandleRenovateApproval(Long requisitionId) {
		String hql="FROM RenovateApprovalDO appr where appr.handleYn='1' and appr.renovateRequistion.id=?";
		Query query=createQuery(hql, requisitionId);
		return query.list();
	}

	/**
	 * 功能描述:查询所有装修申请审批结果<br>
	 * @param requisitionId
	 * @return<br>
	 * Create author:罗军林<br>
	 * Create on:2008-12-31<br>
	 * Edit author:<br>
	 * Edit on:<br>
	 * Why:<br>
	 */
	public List<RenovateApprovalDO> getAllRenovateApproval(Long requisitionId) {
		String hql="FROM RenovateApprovalDO appr where appr.renovateRequistion.id=?";
		Query query=createQuery(hql, requisitionId);
		return query.list();
	}

	/**
	 * 功能描述:得到指定审批人的装修申请审批<br>
	 * @param employeeId
	 * @return<br>
	 * Create author:罗军林<br>
	 * Create on:2008-12-31<br>
	 * Edit author:<br>
	 * Edit on:<br>
	 * Why:<br>
	 */
	public RenovateApprovalDO getRenovateApproval(Long employeeId,Long requisitionId) {
		String hql="FROM RenovateApprovalDO appr where appr.approvalMan.id=? and appr.renovateRequistion.id=?";
		Query query=createQuery(hql, employeeId,requisitionId);
		return (RenovateApprovalDO)query.uniqueResult();
	}



}
